gdk: Add GdkDisplay::init_gl vfunc
authorBenjamin Otte <otte@redhat.com>
Sun, 4 Jul 2021 23:57:03 +0000 (01:57 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 22 Jul 2021 14:23:56 +0000 (16:23 +0200)
commit430b6f8fb1a8d20a1c1744e291c1ae51fdd6faac
treed9d447bff24c22b0c7682cf3d3ac215303ea4509
parentba3e80cbfac5ca8f7553344b80134b70f749a89a
gdk: Add GdkDisplay::init_gl vfunc

The vfunc is called to initialize GL and it returns a "base" context
that GDK then uses as the context all others are shared with. So the GL
context share tree now looks like:

+ context from init_gl
  - context1
  - context2
  ...

So this is a flat tree now, the complexity is gone.

The only caveat is that backends now need to create a GL context when
initializing GL so some refactoring was needed.

Two new functions have been added:

* gdk_display_prepare_gl()
  This is public API and can be used to ensure that GL has been
  initialized or if not, retrieve an error to display (or debug-print).
* gdk_display_get_gl_context()
  This is a private function to retrieve the base context from
  init_gl(). It replaces gdk_surface_get_shared_data_context().
19 files changed:
gdk/gdkdisplay.c
gdk/gdkdisplay.h
gdk/gdkdisplayprivate.h
gdk/gdksurface.c
gdk/gdksurfaceprivate.h
gdk/macos/gdkmacosdisplay.c
gdk/macos/gdkmacosglcontext-private.h
gdk/macos/gdkmacosglcontext.c
gdk/macos/gdkmacossurface.c
gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdkglcontext-wayland.c
gdk/wayland/gdkglcontext-wayland.h
gdk/win32/gdkglcontext-win32.c
gdk/x11/gdkdisplay-x11.c
gdk/x11/gdkglcontext-egl.c
gdk/x11/gdkglcontext-glx.c
gdk/x11/gdkglcontext-x11.c
gdk/x11/gdkglcontext-x11.h
gsk/ngl/gsknglrenderer.c